<template>
    <!-- 
    <b-modal ref="my-modal" hide-footer title="Using Component Methods">
     <div class="d-block text-center">
       <h3>Hello From My Modal!</h3>
     </div>
     <b-button class="mt-3" variant="outline-danger" block @click="hideModal">Close Me</b-button>
     <b-button class="mt-2" variant="outline-warning" block @click="toggleModal">Toggle Me</b-button>
   </b-modal> 
    -->
    <!--
        body-class="modalStyle" 表示样式
        size="lg" 表示模态窗口大小 xl,lg,sm,full
        hide-footer 表示隐藏底部按钮
        hide-header 表示隐藏头部内容
        no-close-on-backdrop 表示鼠标点击背景不可关闭
        hide-header-close 表示隐藏头部关闭按钮
        centered 居中
        ok-title=“确定” 
        cancel-title=取消
        @ok="handleOk" 
        @cancel="handleCancel"
        scrollable 滚动条
        hide-backdrop 隐藏背景
        wrapClassName="ant-modal-cust-warp" 
        style="top:5%;height: 85%;overflow-y: hidden" 样式
    -->
    <b-modal ref="my-modal" :title="title" scrollable hide-footer no-close-on-backdrop>
        <div class="d-block text-center">
            <!--begin::div-->
            <div class="m-form m-form--fit m-form--label-align-left m-form--group-seperator-dashed">
                <div class="m-portlet__body">
                    <div class="form-group m-form__group row">
                        <label class="col-lg-2 col-form-label">名&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;称</label>
                        <div class="col-lg-4">
                            <input class="form-control placeholder-no-fix" type="hidden" v-model="areaForm.PARENT_ID" value="0"/>
                            <input class="form-control placeholder-no-fix" type="hidden" v-model="areaForm.REGION_LEVEL" value="0"/>
                            <input class="form-control" type="text" readonly maxlength="100" v-model="areaForm.NAME" placeholder="请输入">
                        </div>
                    </div>
                    <div class="form-group m-form__group row">
						<label class="col-lg-2 col-form-label">中文简称</label>
						<div class="col-lg-6">
							<input class="form-control placeholder-no-fix" readonly type="text" placeholder="请输入中文简称" v-model="areaForm.NAME_EN"/>
						</div>
					</div>
                    <div class="form-group m-form__group row">
						<label class="col-lg-2 col-form-label">政行编码</label>
						<div class="col-lg-6">
							<input class="form-control" type="text" readonly placeholder="请输入行政编码" v-model="areaForm.CODE"/>
						</div>
					</div>
                    <div class="form-group m-form__group row">
						<label class="col-lg-2 col-form-label">经度</label>
						<div class="col-lg-6">
							<input class="form-control placeholder-no-fix" readonly type="text" style="width:150px" placeholder="请输入经度" v-model="areaForm.LONGITUDE"/>
						</div>
					</div>
                    <div class="form-group m-form__group row">
						<label class="col-lg-2 col-form-label">纬度</label>
						<div class="col-lg-6">
							<input class="form-control placeholder-no-fix" readonly style="width:150px" type="text" placeholder="请输入纬度" v-model="areaForm.LATITUDE"/>
						</div>
					</div>
                </div>
            </div>
        </div>
        <template slot="modal-footer">
        </template>
    </b-modal>        
</template>
<script>
import apiUtil from "@/core/util/apiUtil.js"; 
import { handleNotify,handleAlert,handleConfirm,showWating,closeWating} from "@/core/util/jehcUtil.js";
export default {
    data(){
        return {   
            title:"行政区划详情", 
            areaForm:{
                ID:"",
                NAME: "",
                PARENT_ID:"",
                REGION_LEVEL:"",
                LATITUDE:"",
                NAME_EN:"",
                CODE:"",
                LONGITUDE:"",
                LATITUDE:"",
            }
        }
    },
    components: {
        
    },
    watch: {
    },
    mounted() {
        
    },
    methods: {
        
        showModal(id) {
            this.restForm();
            this.$refs['my-modal'].show();
            this.getAreaDetail(id);
        },
        hideModal() {
            this.$refs['my-modal'].hide()
        },
        toggleModal() {
            // 当模态已隐藏时，我们传递要返回焦点的按钮的ID
            this.$refs['my-modal'].toggle('#toggle-btn')
        },
        restForm(){
            //重置
            Object.assign(this.$data.areaForm, this.$options.data().areaForm);
        },
        getAreaDetail(id){
            apiUtil.get(process.env.VUE_APP_SYS_API+"/xtAreaRegion/get/"+id).then(({ data }) => {                
                this.areaForm = data.data;      
                let type = this.areaForm.REGION_LEVEL;          
                if(type == "0"){
                    this.title="行政区划详情->国家"
                }
                if(type == "1"){
                    this.title="行政区划详情->省份"
                }
                if(type == "2"){
                    this.title="行政区划详情->市"
                }
                if(type == "3"){
                    this.title="行政区划详情->区县"
                }
            });
        },
   }
}
</script>